package main

import (
	"fmt"
	"gitee.com/freedom_feel/gui-bos-api/cmd/initialize"
	"gitee.com/freedom_feel/gui-bos-api/cmd/initialize/client"
	"gitee.com/freedom_feel/gui-bos-api/common/script"
	"gitee.com/freedom_feel/gui-bos-api/config"
	"gitee.com/freedom_feel/gui-bos-api/logs"
	"github.com/robfig/cron/v3"
)

var Version = "0.0.001"

func init() {
	//_type.ErrChan = make(chan _type.Error, 10)
	logs.LogInit()
	config.ViperInit()
	logs.Info(fmt.Sprintf("Version：%v", Version))
}

func main() {
	client.InitMysql()
	client.InitRedis()
	//go
	obj := script.CronObj{CronCtx: cron.New()}
	obj.SetTimeTask()
	// 程序的正常逻辑
	logs.Info("Working...")
	initialize.InitGin()
	//defer close(_type.ErrChan)
	//for {
	//	select {
	//	case err := <-_type.ErrChan:
	//		if strings.Contains(err.Msg, "联系管理人员") {
	//			array := []string{string(global.AuthorEmail)}
	//			common.SendEmail(array, "", err.Msg)
	//			logs.Error(err.Msg)
	//			//return
	//		} else if strings.Contains(err.Msg, "非系统级错误") {
	//			logs.Info(err.Msg)
	//		}
	//	default:
	//		time.Sleep(5 * time.Second)
	//		break
	//	}
	//}
}
